<template>
  <div>
    <div id="main-page">
      <div class="top-bar" @click="topBarClick()">{{openTabs?"收起":"展开"}}导航</div>
      <div id="tabs" class="tabs">
        <img class="logo"  src="../../assets/img/home-logo.png" />
        <div class="desc">一只发疯的程序员</div>
        <div class="tabs-con">
          <div class="tab-item" @click="tabClick(0)">常用工具</div>
          <div class="tab-item" @click="tabClick(1)">在线学习</div>
          <div class="tab-item" @click="tabClick(2)">博客</div>
          <!-- <div class="tab-item">QQ:2051735283</div> -->
        </div>
      </div>
      <div class="container">
        <router-view></router-view>
      </div>
    </div>
    <footer>
      <div class="copy">Powered by  <a target="_blank" href="https://cn.vuejs.org">@Vue</a> , <a target="_blank" href="https://gitee.com">@Gitee</a> , <a target="_blank" href="http://wangloulaowang.gitee.io">@wangloulaowang</a></div>
    </footer>
  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      openTabs:false,
    };
  },
  mounted() {},
  methods: {
    headerClick(index) {
      if (index == 1) {
        alert("QQ:2051735283.");
      } else {
        alert("Nothing!");
      }
    },
    topBarClick() {
      if (document.getElementById("tabs").style.display == "block") {
        document.getElementById("tabs").style.display = "none";
        this.openTabs = false
      } else {
        document.getElementById("tabs").style.display = "block";
        this.openTabs = true
      }
    },
    tabClick(index) {
      if (index == 0) {
        this.$router.push({ path: "/tools", query: {} });
      } else if (index == 1) {
        this.$router.push({ path: "/study", query: {} });
      } else if (index == 2) {
        this.$router.push({ path: "/blog", query: {} });
      }
    },
  },
};
</script>

<style lang='scss'>
@media only screen and (max-width: 677px) {
  #main-page {
    height: 100%;
    width: 100%;
    padding: 50px 0;
  }
  .top-bar {
    display: block;
    width: 100%;
    height: 50px;
    background: #99cccc;
    position: fixed;
    top: 0;
    line-height: 50px;
    box-sizing: border-box;
    text-align: center;
  }
  .tabs {
    width: 100%;
    display: none;
    margin: 0;
  }
  li:not(.blog-item) {
    margin: 20px auto 0;
  }
}
@media only screen and (min-width: 677px) {
  #main-page {
    height: 100%;
    width: 100%;
    max-width: 1000px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding-bottom: 50px;
    margin: 0 auto;
  }
  .top-bar {
    display: none;
  }
  .tabs {
    flex-shrink: 0;
    width: 260px;
    text-align: center;
    border-right: 1px solid #eee;
    border-left: 1px solid #eee;
    // background: #ECF5FF	
  }
  
  li:not(.blog-item) {  
    float: left; 
    margin: 20px 0 0 20px;
  }
}
.tabs .logo {
  display: block;
  margin: 20px auto;
  width: 150px;
}
.desc {
  color: #666;
  text-align: center;
  margin: 20px auto;
}
.tabs-con .tab-item {
  width: 70%;
  margin: 0 auto 20px;
  background: PaleTurquoise;
  height: 40px;
  border-radius: 20px;
  text-align: center;
  line-height: 40px;
  cursor:pointer;
}
.tab-item:hover{
  color: LimeGreen;
}
.container {
  width: 100%;
  background: #f8f8ff;
  box-sizing: border-box;
  ul li:not(.blog-item) {
    background: #ffffff;
    width: 220px;
    height: 80px;
    padding: 10px;
    border-radius: 10px;
    box-sizing: border-box;
    border: 1px solid #00AEAE;
    a {
      color: #707038;
    }
    a:visited {
      color: #996666;
    }
    a:hover {
      color:#00A600;
    }

    a .description {
      color: #AFAF61;
      font-size: 12px;
      margin-top: 10px;
    }
  }
  ul li:hover{
    transform: translateY(-4px)
  }
}
footer{
  // position: fixed;
  bottom: 0;
  width: 100%;
  height: 50px;
  background: rgba($color: DarkSlateGray, $alpha: 0.3);
  text-align: center;
  line-height: 50px;
}
</style>
